Ext
		.onReady(function() {
			var form = Ext
					.create(
							'Ext.form.Panel',
							{
								title : "光伏微网登录系统",
								frame : true,
								width : 300,
								height : 150,
								hidden : false,
								renderTo : 'formDemo',
								defaultType : 'textfield',
								buttonAlign : 'center',
								fieldDefaults : {
									allowBlank : false,
									blankText : '必填项！',
									msgTarget : 'side',
									labelAlign : 'right'
								},
								items : [ {
									fieldLabel : '         用户名',
									labelWidth : 50,
									labelSeparator : ' :  ',
									width : 230,
									name : 'username',
									blankText : '请输入用户名!',

								}, {
									fieldLabel : '         密 码',
									labelWidth : 50,
									labelSeparator : ' :  ',
									width : 230,
									name : 'password',
									inputType : 'password',
									blankText : '请输入密码!',
								} ],
								buttons : [ {
									text : '登录',
									handler : function() {
										var form = this.up('form').getForm();
										form
												.submit({
													clientValidation : true,
													url : 'updateConsignment.php',
													method : 'POST',
													waitMsg : '请稍候',
													waitTitle : '正在验证登录',
													params : {
														newStatus : 'delivered'
													},
													success : function(form,
															action) {
														Ext.Msg
																.alert(
																		'Success',
																		action.result.msg);
													},
													failure : function(form,
															action) {
														switch (action.failureType) {
														case Ext.form.action.Action.CLIENT_INVALID:
															Ext.Msg
																	.alert(
																			'Failure',
																			'Form fields may not be submitted with invalid values');
															break;
														case Ext.form.action.Action.CONNECT_FAILURE:
															Ext.Msg
																	.alert(
																			'Failure',
																			'Ajax communication failed');
															break;
														case Ext.form.action.Action.SERVER_INVALID:
															Ext.Msg
																	.alert(
																			'Failure',
																			action.result.msg);
														}
													}
												})
									}
								} ]

							});
		});
